program tangqiao;

const num=20;

var n:integer;
    shu:array[1..num,1..3] of integer;


procedure input;  {**** input the information ****}
 var i:integer;
 begin
   writeln;
   writeln('Input');
   n:=0;
   while not eoln do
     begin
       read(i);
       inc(n);
       shu[n,1]:=i;
       shu[n,2]:=1;
       shu[n,3]:=0;
     end
 end;




procedure guo;
 var i,j,site,large:integer;
     k:boolean;
 begin
   for i:=n-1 downto 1 do
     begin
      k:=false;
      large:=0;
      for j:=i+1 to n do
         begin
          if shu[i,1]<shu[j,1] then
             begin
               k:=true;
               if shu[j,2]>large then
                 begin
                  site:=j;
                  large:=shu[j,2];
                 end;
             end;
         end;
      if k then
         begin
           shu[i,2]:=shu[i,2]+large;
           shu[i,3]:=site;
         end;
     end;
 end;





procedure output; {**** output the information ***}
 var i,j,m:integer;
 begin
   writeln('Output');
   j:=0;
   for i:=1 to n do
     if shu[i,2]>j then
        begin
         j:=shu[i,2];
         m:=i;
        end;
   writeln('the longest is :',j);
     write('the order is: ');
   while m<>0 do
     begin
       write(shu[m,1],'<');
       m:=shu[m,3];
     end;
 end;

begin
  input;

  guo;

  output;
end.